package com.gmrz.uap.util;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import java.io.*;

/**
 * Created by ouhouki on 16/8/11.
 */
public class JSONUtils {

    private static final Logger LOG = LogManager.getLogger(JSONUtils.class);

    /**
     * 获取指定json文件内的json字符串
     * @param file json文件
     * @return     json字符串
     */
    public static String getJSON(File file){

        BufferedReader bfr = null;
        StringBuilder sb = new StringBuilder();
        try {
            bfr = new BufferedReader(new FileReader(file));
            String len = null;
            while ((len=bfr.readLine())!=null){
                sb.append(len);
            }
        } catch (FileNotFoundException e) {
        } catch (IOException e) {
        } finally {
            if(bfr!=null)
                try {
                    bfr.close();
                } catch (IOException e) {
                }
        }
        return sb.toString();
    }
}
